#ifndef LEETCODE_CN_CPP_JIANZHI_6_H
#define LEETCODE_CN_CPP_JIANZHI_6_H

#include "utils/list.h"
#include <algorithm>
#include <vector>

using namespace std;

namespace jianzhi_6
{

class Solution
{
public:
    vector<int> reversePrint(ListNode *head)
    {
        vector<int> res;
        while (head != nullptr)
        {
            res.push_back(head->val);
            head = head->next;
        }
        reverse(res.begin(), res.end());
        return move(res);
    }
};

} // namespace jianzhi_6

#endif //LEETCODE_CN_CPP_JIANZHI_6_H
